import axios from 'axios'
import Vue from 'vue'

const http = axios.create({
    baseURL: '/api'
})
http.interceptors.request.use(config => {
    if (localStorage.token) {
        config.headers.token = localStorage.token
    }
    return config
}, err => {
    return Promise.reject(err)
})
http.interceptors.response.use(res => {
    return res.data
}, err => {
return Promise.reject(err)
})
export default http